<template>
  <div>
    <div class="page-header">
      <h1>注册 <small>开始使用</small></h1>
    </div>
    <div class="input-group input-group-lg">
      <span class="input-group-addon" id="sizing-addon1">账号</span>
      <input
        type="text"
        class="form-control"
        placeholder="账号"
        aria-describedby="sizing-addon1"
        id="input1"
        v-model="name"
      />
    </div>
    <br />
    <div class="input-group input-group-lg">
      <span class="input-group-addon" id="sizing-addon1">密码</span>
      <input
        type="text"
        class="form-control"
        placeholder="密码"
        aria-describedby="sizing-addon1"
        id="input2"
        v-model="password"
      />
    </div>
    <br />
    <div class="input-group input-group-lg">
      <span class="input-group-addon" id="sizing-addon1">密码</span>
      <input
        type="text"
        class="form-control"
        placeholder="确认密码"
        aria-describedby="sizing-addon1"
        id="input2"
        v-model="password2"
      />
    </div>
    <br />
    <div class="btn-group btn-group-lg" role="group" aria-label="...">
      <button type="button" class="btn btn-default" @click="goTo()">
        注册
      </button>
    </div>
  </div>
</template>
<script>
/* import axios from "axios" */
import $ from "jquery";
import { requests } from "../request/request";
import {registerAxios} from "../request/api"
export default {
  name: "login",
  data() {
    return {
      method: "register",
      name: "",
      password: "",
      password2: "",
    };
  },
  computed: {
 
  },
  methods: {
    goTo() {
      if (this.name == "" || this.password == "" || this.password2 == "") {
        alert("请填写完整注册信息");
      } else if (this.password != this.password2) {
        alert("密码和确认密码不一致");
      } else {
        let json ={
          "uname":this.name,
          "upassword":this.password
        }
        let thisa = this
       registerAxios(json,thisa)
        /* this.$router.push("/"); */
      }
    },
  },
};
</script>
<style scoped>
</style>
